//
//  OAuthViewController.swift
//  微博
//
//  Created by 刘静 on 15/10/14.
//  Copyright © 2015年 liujing.cn. All rights reserved.
//

import UIKit
//import SVProgressHUD
class OAuthViewController: UIViewController,UIWebViewDelegate {

    //MARK:搭建界面
    
    private lazy var webView = UIWebView()
    
    override func loadView() {
        view = webView
//       webView.delegate = self
//        title = "新浪微博"
//        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "关闭", style: UIBarButtonItemStyle.Plain, target: self, action:"close")
    }
    
    override func viewDidUnload() {
        super.viewDidLoad()
        
        webView.loadRequest(NSURLRequest(URL: NetworkTools.sharedTools))
    }


///  关闭界面
    
    func close(){
    
    dismissViewControllerAnimated(true, completion: nil)
    
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()

      //加载授权页面
        webView.loadRequest(NSURLRequest(URL: NetworkTools.sharedTools.oauthUrl()))
        
    }
    //MARK: -UIWebViewDelegate
    
    func webViewDidStartLoad(webView: UIWebView) {
        SVProgressHUD.show()
    }
    
    func webViewDidFinishLoad(webView: UIWebView) {
       SVProgressHUD.dismiss()
    }
    
    
    
   

}
